home *** CD-ROM | disk | FTP | other *** search
- Path: skivs.ski.org!usenet
- From: gt@ns.oon.or.jp (Gemini Thunder)
- Newsgroups: comp.lang.c
- Subject: RAND_MAX
- Date: Mon, 01 Apr 1996 05:55:01 GMT
- Organization: Smith-Kettlewell Eye Research Institute
- Message-ID: <4jnr55$e6l@skivs.ski.org>
- NNTP-Posting-Host: 143.45.100.64
- X-Newsreader: Forte Free Agent 1.0.82
-
- I have a (stupid) question / observation about RAND_MAX.
-
- K&R2 says:
- "rand returns a a pseudo-random integer in the range 0 to RAND_MAX,
- which is at least 32767"
-
- It looks like RAND_MAX is not required to be the same as any other
- limit (such as MAX_INT, etc.), that is fine, but why?
- Wouldn't it be easier if RAND_MAX == MAX_INT or some other value?
-
- The reason I say this is how can you be sure your array will hold a
- RAND_MAX sized integer, without some checking before hand, if RAND_MAX
- is out there doing its own thing?
-
- Or does ANSI pin it down (in which case why have a RAND_MAX #defined),
- or am I just worked up over nothing and overlooking something obvious?
-
- Please Email me in reply, so I can turn this in as homework, since my
- time is too precious to read this newsgroup for answers I can't figure
- out on my own. <that was supposed to be sarcastic>
-
-
-